package com.example.dairenkun.neufoodshop.model;

import com.example.dairenkun.neufoodshop.bean.AddComment;
import com.example.dairenkun.neufoodshop.bean.Buy;
import com.example.dairenkun.neufoodshop.bean.DelComment;
import com.example.dairenkun.neufoodshop.bean.Order;
import com.example.dairenkun.neufoodshop.service.CommentService;
import com.example.dairenkun.neufoodshop.service.FoodService;
import com.example.dairenkun.neufoodshop.service.OrderService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Administrator on 2017/5/8.
 */

public class OrderModel {
    Retrofit retrofit;
    public OrderModel(){
        retrofit=new Retrofit.Builder()
                .addConverterFactory(GsonConverterFactory.create())
                .baseUrl("http://60.205.189.39/")
                .build();
    }
    //购买
    public Call Buy(int userid,int foodid,int num,double sum,String suggesttime){
        OrderService testService=retrofit.create(OrderService.class);
        return testService.Buyorder(userid,foodid,1,sum,suggesttime);

    }
    //订单列表
    public Call OrderList(int userid){
        OrderService Service=retrofit.create(OrderService.class);
        return Service.getOrderList(userid);
    }
    //获取我的评论列表
    public  Call MyCommentList(int userid){
        CommentService Service=retrofit.create( CommentService.class);
        return Service.getCommentList(userid);
    }
// 删除评论
public  Call DelComment(int orderid){
    CommentService testService=retrofit.create(CommentService.class);
    return testService.DelComment(orderid);
}
    //添加评论
    public  Call AddComment(int orderid,String Content){
        CommentService Service=retrofit.create(CommentService.class);
        return Service.InsertComment(orderid,Content);
    }
}
